
<template>
  <el-form
    :model="editStore"
    label-width="150px"
    class="demo-ruleForm"
  >
    <el-form-item label="店名" prop="name">
      <el-input v-model="editStore.name" style="width:200px"></el-input>
    </el-form-item>
    <el-form-item label="营业执照编号" prop="businessphone">
      <el-input v-model="editStore.businessphone" style="width:200px"></el-input>
    </el-form-item>
    <el-form-item label="营业执照照片" prop="businessimg">
      <el-input v-model="editStore.businessimg" style="width:200px"></el-input>
    </el-form-item>
    <el-form-item label="店地址" prop="address">
      <el-input v-model="editStore.address" style="width:200px"></el-input>
    </el-form-item>
    <el-form-item label="定位" prop="positioning">
      <el-input v-model="editStore.positioning" style="width:200px"></el-input>
    </el-form-item>
    <el-form-item label="所在城市" prop="city">
      <el-input v-model="editStore.city" style="width:200px"></el-input>
    </el-form-item>
    <el-form-item label="法人" prop="method">
      <el-input v-model="editStore.method" style="width:200px"></el-input>
    </el-form-item>
    <el-form-item label="联系电话" prop="phone">
      <el-input v-model="editStore.phone" style="width:200px"></el-input>
    </el-form-item>
    <el-form-item label="门店法人大头照" prop="headimg">
      <el-input v-model="editStore.headimg" style="width:200px"></el-input>
    </el-form-item>
    <el-form-item label="佣金比例" prop="commissionratio">
      <el-input v-model="editStore.commissionratio" style="width:200px"></el-input>
    </el-form-item>
    <el-form-item>
    <el-button type="primary" @click="submitForm('ruleForm')">立即修改</el-button>
    <el-button @click="resetForm('ruleForm')">重置</el-button>
  </el-form-item>
  </el-form>
</template>
<script>
import storeApi from "../../services/store"
export default {
   
  data() {
    return {
      editData: {
        name: "",
        businessphone: "",
        businessimg: "",
        address: "",
        positioning: "",
        city: "",
        method: "",
        phone: "",
        headimg: "",
        commissionratio: ""
      },
      rules: {
        // name: [
        //   { required: true, message: "请输入活动名称", trigger: "blur" },
        //   { min: 3, max: 5, message: "长度在 3 到 5 个字符", trigger: "blur" }
        // ],
        // businessphone: [
        //   { required: true, message: "请输入活动名称", trigger: "blur" },
        //   { min: 3, max: 5, message: "长度在 3 到 5 个字符", trigger: "blur" }
        // ],
        // businessimg: [
        //   { required: true, message: "请输入活动名称", trigger: "blur" },
        //   { min: 3, max: 5, message: "长度在 3 到 5 个字符", trigger: "blur" }
        // ],
        // address: [
        //   { required: true, message: "请输入活动名称", trigger: "blur" },
        //   { min: 3, max: 5, message: "长度在 3 到 5 个字符", trigger: "blur" }
        // ],
        // positioning: [
        //   { required: true, message: "请输入活动名称", trigger: "blur" },
        //   { min: 3, max: 5, message: "长度在 3 到 5 个字符", trigger: "blur" }
        // ],
        // city: [
        //   { required: true, message: "请输入活动名称", trigger: "blur" },
        //   { min: 3, max: 5, message: "长度在 3 到 5 个字符", trigger: "blur" }
        // ],
        // method: [
        //   { required: true, message: "请输入活动名称", trigger: "blur" },
        //   { min: 3, max: 5, message: "长度在 3 到 5 个字符", trigger: "blur" }
        // ],
        // phone: [
        //   { required: true, message: "请输入活动名称", trigger: "blur" },
        //   { min: 3, max: 5, message: "长度在 3 到 5 个字符", trigger: "blur" }
        // ],
        // headimg: [
        //   { required: true, message: "请输入活动名称", trigger: "blur" },
        //   { min: 3, max: 5, message: "长度在 3 到 5 个字符", trigger: "blur" }
        // ],
        // commissionratio: [
        //   { required: true, message: "请输入活动名称", trigger: "blur" },
        //   { min: 3, max: 5, message: "长度在 3 到 5 个字符", trigger: "blur" }
        // ]
      }
    };
  },
  async created(){
        await this.$store.dispatch("stores/getEditStore",this.$route.params.id)
    },
    computed:{
        editStore(){
            return this.$store.state.stores.editStore
        }
    },
    methods:{
       async  submitForm(){
           await storeApi.modifyStore(this.editStore);
            this.$router.push({
                name:"store"
            })
        }
        
    }
};
</script>